home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_10 / jagger / printf1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-28  |  639 b   |  28 lines

  1. /* Listing 4, printf.c, version 1 */
  2. #include <stdarg.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. #include "check.h"    /* Listing 1 */
  7. #include "printf.h"    /* Listing 3 */
  8.  
  9. const char srcCall[] = 
  10.   "int printf(const char format[],...)";
  11.  
  12. int DB_printf( const char format[], ... )
  13.   {
  14.   va_list ap;
  15.   int returnValue;
  16.  
  17.   UNDEFINED_IF(format == NULL);
  18.   WARNING_IF(strchr(format, '%') == NULL);
  19.   WARNING_IF(strstr(format, "%ul") != NULL);
  20.   WARNING_IF(strstr(format, "%p") != NULL);
  21.   va_start(ap, format);
  22.   returnValue = vprintf(format, ap);
  23.   va_end(ap);
  24.   WARNING_IF(returnValue < 0);
  25.   return returnValue;
  26.   }
  27.  
  28.